#include "mainwindow.h"

#include <QApplication>
#include <QCommandLineParser>
#include <QLocale>
#include <QTranslator>

int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(filetreeviewer);
    QApplication app(argc, argv);
    app.setApplicationName("FileTreeViewer");
    app.setOrganizationName("FileTreeViewer");

    QString locale = QLocale::system().name();
    QTranslator translator;
    translator.load(":/i18n/" + QString("FileTreeViewer_") + locale);
    app.installTranslator(&translator);

    QCommandLineParser parser;
    parser.addPositionalArgument("file", "File to open");
    parser.addHelpOption();
    parser.process(app);

    MainWindow win;
    if(!parser.positionalArguments().isEmpty())
        win.loadFile(parser.positionalArguments().at(0));
    win.show();
    return app.exec();
}
